var screenHeight = 500;
var moduledata = [
  {module_name:'班车信息',module_icon:'&#xe626;',module_color:'#ec407a',module_hide:true},
  {module_name:'智能楼宇',module_icon:'&#xe632;',module_color:'#5FC359',module_hide:false},
  {module_name:'物业管理',module_icon:'&#xe62c;',module_color:'#e6b500',module_hide:true},
  {module_name:'园区快递',module_icon:'&#xe635;',module_color:'#8e24aa',module_hide:false},
  {module_name:'天气信息',module_icon:'&#xe640;',module_color:'#005aff',module_hide:false},
  {module_name:'园区健康',module_icon:'&#xe61a;',module_color:'#dd191d',module_hide:false},
  {module_name:'餐饮美食',module_icon:'&#xe622;',module_color:'aqua',module_hide:false},
  {module_name:'园区休闲',module_icon:'&#xe63b;',module_color:'#ec407a',module_hide:false},
  {module_name:'知识仓库',module_icon:'&#xe630;',module_color:'#76EE00',module_hide:false},
  {module_name:'优惠金券',module_icon:'&#xe617;',module_color:'lightskyblue',module_hide:false},
  {module_name:'视频播放',module_icon:'&#xe605;',module_color:'blue',module_hide:true}
];
angular.module('starter.controllers', [])
.controller('DashCtrl', function($scope,$window,$state,CONSTANT,LS) {
  screenHeight = $window.innerHeight;
  $scope.toOtherPage = function(index){
    if(index==4)
    {
      $state.go('manage');
    }
  };
  $scope.$on('$ionicView.beforeEnter', function () {
    if(LS.getObject(CONSTANT.app_list)==null||typeof (LS.getObject(CONSTANT.app_list))=='undefined')
    {
      LS.setObject(CONSTANT.app_list,moduledata)
    }
  });
  $scope.$on('$ionicView.afterEnter', function () {
    $scope.module = LS.getObject(CONSTANT.app_list);
  });
  $scope.goPage = function(item){
    if(item.module_name=='视频播放')
    {
      $state.go('video');
    }
  }
})

.controller('ChatsCtrl', function($scope, Chats) {
  // With the new view caching in Ionic, Controllers are only called
  // when they are recreated or on app start, instead of every page change.
  // To listen for when this page is active (for example, to refresh data),
  // listen for the $ionicView.enter event:
  //
  //$scope.$on('$ionicView.enter', function(e) {
  //});

  $scope.chats = Chats.all();
  $scope.remove = function(chat) {
    Chats.remove(chat);
  };
})

.controller('ChatDetailCtrl', function($scope, $stateParams, Chats) {
  $scope.chat = Chats.get($stateParams.chatId);
})

.controller('AccountCtrl', function($scope) {
  $scope.settings = {
    enableFriends: true
  };
});
